<?php



/* function json($code = 1, $msg = '', $data = '')

{

    header('Content-Type:application/json;charset=utf-8');

    $_data = array(

	    'url' => $_GET['url'],

        'code' => $code,

        'msg' => $msg,

        'data' => $data

    );

    echo json_encode($_data);

    exit;

} */



$agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H321 MicroMessenger/6.2.4 NetType/WIFI Language/zh_CN';  

$from = 'http://wx.qq.com/';

$cookie ='pgv_pvi=3330197504; RK=eOeC71pvsr; tvfe_boss_uuid=0559fa9fee047cff; ptcz=7bfbab5d19808e5afb0a059bc6932fa067b4602155e3075e834f9d1b72360d10; pt2gguin=o1058544403; eas_sid=o1f5f1o492Y264A3N6W088p7V9; ue_uid=d6b7ec35e92a57e796b02297a59a53ed; LW_uid=a1Z561n4w2A2r4a3w8C7M2b2Z4; ue_ts=1520085325; ue_uk=82548f889eee2532edb7dceb3f0c7125; ue_skey=027d967f5a91d07135fb3f5cad798422; LW_sid=01z5b2i050h8R5M3T2k596C6V8; LW_TS=1520085325; LW_PsKey=25c493b4ebb51078f4bb739f802219b8; LW_pid=bf7f6672b17a8331008ab037155823c9; pgv_pvid_new=1058544403_8fb7b92409; pgv_si=s7233427456; webwxuvid=45551d5ba32ac2d757af1084602a6abb3eff671b400e7bdad68b4d1054a807646e5eca52a1f7c4a106d5a4ec2e3b52fe; webwx_auth_ticket=CIsBEKXJ6JINGoAB3PwWkAqufAJF/lS/NEOvtkwWVK6ZYCIEVxm9a+oISsjW3jmgPlgDoHVjp9Q0FxgR78BryEZoiUyt9O26jVo5NhTDvenmzYgMDA9eba8BsrxquNmHFtkLckW8fy/uFZc7LCO30CEVYF1eGnj148TBxFL7lLwABRlI4qB/v9szTAQ=; o_cookie=1058544403; pgv_info=ssid=s5722842986; pgv_pvid=5198978184; wxpluginkey=1520669762; wxuin=1842735308; wxsid=i+IYWOrJQlrr7TQg; webwx_data_ticket=gScEm8a/e3jIrymKcG4R9Y8r';   //必须

$url = 'https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxcheckurl?';

$check_url = $_GET['url'];

$params2 = array(

    'requrl'=> $check_url,

    'skey'=>'@crypt_264b2232_a4764da4514cbaa0e12c9aaf57ea74e4',  //必须

/*     'deviceid'=>'e288957836572081',   //必须

    'pass_ticket'=>'FT9pIkNHhAxUcUKMKpXsc5KROYktIeUaIkyPGulLcmbF%2BBW%2BUAnN2JO2abj4iUrh',  //必须

    'opcode'=>'2',

    'scene'=>'1',

    'username'=>'@f10a22ff5b1e8ecc4ba1bb85da3246da79038429a5f8bd4a8f622af9f8db07b7',   //必须 */

);

$url .= http_build_query($params2);

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl, CURLOPT_USERAGENT, $agent);

curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120);

curl_setopt($curl, CURLOPT_TIMEOUT, 120);

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($curl, CURLOPT_HEADER, 1);

curl_setopt($curl, CURLOPT_REFERER, $from);

curl_setopt($curl, CURLOPT_COOKIE, $cookie);



$result = curl_exec($curl);

//echo $result ;



curl_close($curl);

if(strpos($result,"weixin110.qq.com"))

{

	

	echo "1";

}

 else

 {

	 echo "0";

 }

/* preg_match("/Location: (.*)/", $result, $matches);

if(isset($matches[1]))

{

   //json(0,'',array('status'=>2));

   echo "0";

}

else

{

    $curl = curl_init($url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($curl, CURLOPT_USERAGENT, $agent);

    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);

    curl_setopt($curl, CURLOPT_TIMEOUT, 60);

    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);



    curl_setopt($curl, CURLOPT_REFERER, $from);

    curl_setopt($curl, CURLOPT_COOKIE, $cookie);

    $result = curl_exec($curl);

    curl_close($curl);

    if(strpos($result,'继续访问') === false)

    {

        

	    //json(0,'',array('status'=>-1));

		echo "1";

    }

    else

    {

        

		  //json(0,'',array('status'=>1));

		echo "0";

    }

} */